package com.ifonly.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author <a href="mailto:ifonlymaster@163.com">ifonly</a>
 * @version 1.0 2015-12-11 16:32
 * @since JDK 1.6
 */
public class DateTimeUtils {

    public static final String YYYY_MM_DD = "yyyy-MM-dd";
    public static final String YYYY_MM_DD$HH_MM_SS = "yyyy-MM-dd HH:mm:ss";


    public static String format(Date date) {
        return format(date, YYYY_MM_DD$HH_MM_SS);
    }

    public static String format(Date date, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(date);
    }

}
